﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using Entity;
using DbCommon;

namespace Web.admin.tool
{
    /// <summary>
    /// CheckStudnetByCode 的摘要说明
    /// </summary>
    public class CheckStudnetByCode : IHttpHandler
    {

        public void ProcessRequest(HttpContext context)
        {
            //不让浏览器设有缓存
            context.Response.Buffer = true;
            context.Response.ExpiresAbsolute = DateTime.Now.AddDays(-1);
            context.Response.AddHeader("pragma", "no-cache");
            context.Response.AddHeader("cache-control", "");
            context.Response.CacheControl = "no-cache";
            context.Response.ContentType = "text/plain";
            object studentCode = context.Request["STU_CODE"];
            BLL.StudentService studentservice = new BLL.StudentService();
            BoStudents StudentModel = studentservice.GetV_studentByCode(studentCode.ToString());
            if (StudentModel != null)
            {

                string jsonData = JsonHelper.ObjectToJSON(StudentModel);
                context.Response.Write(jsonData);
            }
            else
            {
                context.Response.Write("该学生不存在");
            }

        }

        public bool IsReusable
        {
            get
            {
                return false;
            }
        }
    }
}